﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:w="http://schemas.jelle.druyts.net/2010/xaml/presentation">

    <w:EnumToBooleanConverter x:Key="enumConverter" />

    <SolidColorBrush x:Key="TextBrush" Color="White" />
    <SolidColorBrush x:Key="InfoFontBrush" Color="LightGray" />
    <SolidColorBrush x:Key="UserMessageFontBrush" Color="DarkGray" />
    <SolidColorBrush x:Key="ErrorForegroundBrush" Color="Red" />
    <SolidColorBrush x:Key="WarningForegroundBrush" Color="Orange" />
    <SolidColorBrush x:Key="SuccessForegroundBrush" Color="#50DD50" />
    <SolidColorBrush x:Key="PicturePreviewTitleBrush" Color="Black" />

    <SolidColorBrush x:Key="InputBackgroundBrush" Color="#E0E0E0" />
    <SolidColorBrush x:Key="InputBackgroundBrushReadOnly" Color="DarkGray" />

    <SolidColorBrush x:Key="SelectedTabTextBrush" Color="White" />
    <SolidColorBrush x:Key="UnSelectedTabTextBrush" Color="Gray" />
    <SolidColorBrush x:Key="ActiveTabTextBrush" Color="DarkGray" />

    <SolidColorBrush x:Key="ImageBorderBorderBrush" Color="#E0E0E0" />
    <SolidColorBrush x:Key="ImageBorderFillBrush" Color="#E0E0E0" />

    <LinearGradientBrush x:Key="ImageBorderPartialFillBrush" StartPoint="0,0" EndPoint="1,1">
        <GradientStop Color="#E0E0E0" Offset="0.000" />
        <GradientStop Color="Transparent" Offset="0.125" />
        <GradientStop Color="#E0E0E0" Offset="0.250" />
        <GradientStop Color="Transparent" Offset="0.375" />
        <GradientStop Color="#E0E0E0" Offset="0.500" />
        <GradientStop Color="Transparent" Offset="0.625" />
        <GradientStop Color="#E0E0E0" Offset="0.750" />
        <GradientStop Color="Transparent" Offset="0.875" />
        <GradientStop Color="#E0E0E0" Offset="1.000" />
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="ResizeGripperForeground" EndPoint="1,0.75" StartPoint="0,0.25">
        <GradientStop Color="#FFFFFF" Offset="0.3"/>
        <GradientStop Color="#BBC5D7" Offset="0.75"/>
        <GradientStop Color="#6D83A9" Offset="1"/>
    </LinearGradientBrush>
    <Style x:Key="ResizeGripThumbStyle" TargetType="{x:Type Thumb}">
        <Setter Property="MinWidth" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>
        <Setter Property="MinHeight" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Grid SnapsToDevicePixels="true" Background="{TemplateBinding Background}">
                        <Path HorizontalAlignment="Right" Margin="0,0,2,2" VerticalAlignment="Bottom" Data="M 9,0 L 11,0 L 11,11 L 0,11 L 0,9 L 3,9 L 3,6 L 6,6 L 6,3 L 9,3 z">
                            <Path.Fill>
                                <DrawingBrush TileMode="Tile" Viewbox="0,0,3,3" ViewboxUnits="Absolute" Viewport="0,0,3,3" ViewportUnits="Absolute">
                                    <DrawingBrush.Drawing>
                                        <DrawingGroup>
                                            <GeometryDrawing Brush="{StaticResource ResizeGripperForeground}" Geometry="M 0,0 L 2,0 L 2,2 L 0,2 z "/>
                                        </DrawingGroup>
                                    </DrawingBrush.Drawing>
                                </DrawingBrush>
                            </Path.Fill>
                        </Path>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type TabControl}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="TabControl">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <TabPanel Grid.Row="0" IsItemsHost="true"/>
                        <ContentPresenter Grid.Row="1" ContentSource="SelectedContent" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type TabItem}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <ContentControl Margin="0,5,15,5" x:Name="tabHeader" Foreground="{StaticResource UnSelectedTabTextBrush}" FontSize="16">
                        <ContentPresenter ContentSource="Header" />
                    </ContentControl>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Foreground" Value="{StaticResource SelectedTabTextBrush}" TargetName="tabHeader" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Border.IsMouseOver" Value="True"/>
                                <Condition Property="IsSelected" Value="False"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Foreground" Value="{StaticResource ActiveTabTextBrush}" TargetName="tabHeader" />
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

    </Style>

    <Style TargetType="{x:Type Expander}">
        <Setter Property="Foreground" Value="{DynamicResource TextBrush}" />
        <Setter Property="IsExpanded" Value="True" />
    </Style>

    <Style TargetType="{x:Type TextBox}">
        <Setter Property="Background" Value="{DynamicResource InputBackgroundBrush}" />
        <Setter Property="IsReadOnlyCaretVisible" Value="True" />
        <Style.Triggers>
            <Trigger Property="IsReadOnly" Value="True">
                <Setter Property="Background" Value="{DynamicResource InputBackgroundBrushReadOnly}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style TargetType="{x:Type DockPanel}" />
    <Style TargetType="{x:Type Grid}" />
    <Style TargetType="{x:Type GridSplitter}" />
    <Style TargetType="{x:Type StackPanel}" />

    <Style TargetType="{x:Type Label}">
        <Setter Property="FontWeight" Value="Bold" />
        <Setter Property="Padding" Value="0 10 0 5" />
        <Setter Property="Foreground" Value="{DynamicResource InputFontColor}" />
    </Style>
    
    <Style TargetType="{x:Type Label}" x:Key="InlineLabel">
        <Setter Property="Foreground" Value="{DynamicResource FontColor}" />
        <Setter Property="Padding" Value="0" />
    </Style>

    <Style TargetType="{x:Type Hyperlink}">
        <Style.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="TextDecorations" Value="None" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style TargetType="{x:Type CheckBox}">
        <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}" />
    </Style>

    <Style TargetType="{x:Type GroupBox}">
        <Setter Property="Foreground" Value="{DynamicResource TextBrush}" />
        <Setter Property="BorderThickness" Value="0.5" />
    </Style>

    <Style x:Key="FlickrCollectionListStyleBase" TargetType="{x:Type ListBox}">
        <!-- Remove the white background for disabled list boxes -->
        <!-- See http://stackoverflow.com/questions/2594714/change-background-color-of-disabled-listbox-in-windows-classic-theme -->
        <Style.Resources>
            <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent"/>
            <SolidColorBrush x:Key="{x:Static SystemColors.WindowBrushKey}" Color="Transparent"/>
            <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent"/>
        </Style.Resources>
        <Setter Property="SelectionMode" Value="Multiple" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="ItemContainerStyle">
            <Setter.Value>
                <Style TargetType="{x:Type ListBoxItem}" >
                    <Setter Property="IsSelected" Value="{Binding IsSelected}" />
                    <Setter Property="VerticalContentAlignment" Value="Top" />
                </Style>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="FlickrCollectionListStyleTextOnly" TargetType="{x:Type ListBox}" BasedOn="{StaticResource FlickrCollectionListStyleBase}">
        <Setter Property="ItemTemplate">
            <Setter.Value>
                <DataTemplate>
                    <CheckBox IsChecked="{Binding IsSelected}" IsEnabled="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=IsEnabled}"><Label Style="{DynamicResource InlineLabel}" Content="{Binding Path=Collection.Name, Mode=OneWay}" /></CheckBox>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="FlickrCollectionListStyleTextAndIcon" TargetType="{x:Type ListBox}" BasedOn="{StaticResource FlickrCollectionListStyleBase}">
        <!-- Disable the ListBox's built-in scrollbar so that the WrapPanel wraps properly -->
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <WrapPanel IsItemsHost="True" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemTemplate">
            <Setter.Value>
                <DataTemplate>
                    <CheckBox IsChecked="{Binding IsSelected}" IsEnabled="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsEnabled}">
                        <CheckBox.Template>
                            <ControlTemplate>
                                <StackPanel ToolTip="{Binding Path=Collection.Name}">
                                    <Border x:Name="pictureBorder" Style="{DynamicResource BorderStyle}" Background="Transparent" Padding="5" Margin="5">
                                        <w:BackgroundLoadingImage Source="{Binding Path=PlaceholderImage}" ActualSource="{Binding Path=Collection.ImageUrl}" Stretch="Fill" Width="48" Height="48" />
                                    </Border>
                                    <Border HorizontalAlignment="Center" Width="48">
                                        <TextBlock Foreground="{DynamicResource FontColor}" Text="{Binding Path=Collection.Name}" HorizontalAlignment="Center" TextTrimming="None" TextWrapping="Wrap" />
                                    </Border>
                                </StackPanel>
                                <ControlTemplate.Triggers>
                                    <DataTrigger Binding="{Binding Path=IsSelected}" Value="True">
                                        <Setter TargetName="pictureBorder" Property="Background" Value="{DynamicResource ImageBorderFillBrush}" />
                                    </DataTrigger>
                                    <DataTrigger Binding="{Binding Path=IsSelected}" Value="{x:Null}">
                                        <Setter TargetName="pictureBorder" Property="Background" Value="{DynamicResource ImageBorderPartialFillBrush}" />
                                    </DataTrigger>
                                </ControlTemplate.Triggers>
                            </ControlTemplate>
                        </CheckBox.Template>
                    </CheckBox>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ControlTemplate TargetType="CheckBox" x:Key="lockCheckBox">
        <Image Name="lockCheckBoxImage" Source="/Resources/LockOpen.png" Width="16" Height="16" ToolTip="Lock this panel so that it doesn't automatically open or close" />
        <ControlTemplate.Triggers>
            <Trigger Property="IsChecked" Value="True">
                <Setter TargetName="lockCheckBoxImage" Property="Source" Value="/Resources/LockClosed.png" />
                <Setter TargetName="lockCheckBoxImage" Property="ToolTip" Value="Unlock this panel so that it automatically opens when a selection is made" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

</ResourceDictionary>